package Month09.day0928;


import java.util.Objects;

public class Persion {
    String name;
    int age;

    public Persion(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public boolean equals(Object o){
        if(this == o){
            return true;
        }

        if(!(o instanceof Persion)){
            return false;
        }

        Persion key = (Persion)o;
        return this.name == key.name && this.age == key.age;
    }
    @Override
    public int hashCode(){
        return Objects.hash(name,age);
    }
    public static void main(String[] args) {
        Persion p1 = new Persion("光头强",18);
        Persion p2 = new Persion("光头强",18);
        System.out.println(p1.equals(p2));
        System.out.println(p1.hashCode());
        System.out.println(p2.hashCode());

    }
}
